<?php

class __users_mail extends Module {
	
	public function __construct () {
		parent::__construct ('users');
	}
	
	public function registrationConfirm (Object $oRegistration) {
		$template = new SimpleTemplate ('users/mailRegConfirm.tpl');
		$template->setVar ('{userName}', $oRegistration->getValue ('name'));
		$template->setVar ('{key}', $oRegistration->getValue ('key'));
		
		Mailer::sendEMail (new EMail ($oRegistration->getValue ('email'), $template->display (), lang('email_registration_subject','users')), true);
	}
	
	public function sendNewPassword(Object $oUser, $newPass) {
		$template = new SimpleTemplate ('users/newPassword.tpl');
		$template->setVar ('{userName}', $oUser->getValue ('name'));
		$template->setVar ('{password}', $newPass);
		
		Mailer::sendEMail (new EMail ($oUser->getValue ('email'), $template->display (), lang('email_new_password','users')), true);
	}
	
}